from selenium.webdriver.common.by import By


class  UserMyTicketLocator:
    # Ticket菜单
    ticket_tab = (By.XPATH, "//div[contains(@data-menu-id,'TICKET')]")
    # new ticket菜单
    my_ticket_tab = (By.CSS_SELECTOR, '[path="/work_bench/tickets/myTicket"]')

    ticket_id = (By.XPATH, '//*[@id="root"]/section/section/main/div/main/div/div/div/div[2]/div/div[2]/div/div/div/div/div/table/tbody/tr[2]/td[1]/a')

    search_ticket_id = (By.XPATH, '//*[@id="root"]/section/section/main/div/main/div/div/div/div[2]/div/div[2]/div/div/div/div/div/table/tbody/tr[2]/td[1]/span/span[2]/a')

    #ticket_comments = (By.XPATH,'//*[@id="root"]/section/section/main/div/main/div/div/div/div/div/div[3]/div/div[4]/div[2]/div/div[1]/div[2]/div/div[2]/div/div')
    ticket_comments = (By.XPATH,'//*[@data-contents="true"]/div/div')

    #ticket_send = (By.XPATH,'//*[@id="root"]/section/section/main/div/main/div/div/div/div/div/div[3]/div/div[4]/div[2]/div/div[2]/button')
    ticket_send = (By.XPATH,'//*[text()="Send"]/..')

    ticket_last_comment = (By.XPATH,'//*[@id="scrollableDiv"]/div/div/div[2]/div/div[2]/div/p')
    ticket_reopen_comment = (By.XPATH,'//*[@id="scrollableDiv"]/div/div/div[1]/div/div[2]/div')
    ticket_reopen_send_comment = (By.XPATH,'//*[@id="scrollableDiv"]/div/div/div[1]/div/div[2]/div/p')

    #工单列表页优先级筛选按钮
    ticket_priority_filter = (By.XPATH,"(//span[contains(@class,'antd4-table-filter-trigger')])[1]")

    ticket_pending_status = (By.CSS_SELECTOR,'/html/body/div[8]/div/div/div/ul/li[1]/span/label/span/input')

    ticket_status_filter_confirm = (By.XPATH,'/html/body/div[8]/div/div/div/div[2]/button[2]')

    #工单关单按钮-列表
    ticket_close_button_list = (By.XPATH,'//*[text()="Close"]/..')

    #列表页面确认关闭工单
    ticket_close_button_confirm_list = (By.XPATH,"(//button[contains(@class,'antd4-btn-primary')])")
    ticket_close_button_confirm_list2 = (By.XPATH, "(//button[contains(@class,'antd4-btn-primary')])[3]")
    #工单关单按钮-详情页
    ticket_close_button_detail = (By.XPATH,'//*[@id="root"]/section/section/main/div/main/div/div/div/div/div/div[2]/div/div[2]/div/div/button')

    #工单列表页面，最近一条工单的状态
    last_ticket_status = (By.XPATH,'//*[@id="root"]/section/section/main/div/main/div/div/div/div[2]/div/div[2]/div/div/div/div/div/table/tbody/tr[2]/td[8]/span/span[2]')

    # 详情页的reopen按钮
    ticket_reopen_button_detail = (By.XPATH, "(//button[contains(@class,'antd4-btn-primary')])[1]")
    #工单详情页面关闭按钮--工单状态为pending和solving时
    ticket_close_button_detail = (By.XPATH, "(//button[contains(@class,'antd4-btn-primary')])[1]")

    # 工单详情页面关闭确认按钮
    ticket_close_button_confirm_detail = (By.XPATH, "(//button[contains(@class,'antd4-btn-primary')])[3]")
    #工单详情页面reopen确认按钮
    ticket_reopen_button_confirm_detail = (By.XPATH, "(//button[contains(@class,'antd4-btn-primary')])[4]")
    #工单关闭后，详情页提示
    ticket_close_text = (By.XPATH,'//*[text()="Sorry, the ticket has been closed, the comment is not supported."]')

    # my ticket页面搜索框
    search_box = (By.ID, 'keywords')
    # my ticket页面搜索按钮
    search_button = (By.XPATH, '//button[contains(@class,"antd4-input-search-button")]')
    # 表格筛选框
    # ticket_status
    ticket_status_filter = (By.XPATH, '(//span[contains(@class,"antd4-table-filter-trigger")])[2]')
    # 工单状态的选择框
    pending_for_service = (By.XPATH, '(//label[contains(@class,"antd4-checkbox-wrapper")])[5]')
    solving = (By.XPATH, '(//label[contains(@class,"antd4-checkbox-wrapper")])[6]')
    solved = (By.XPATH, '(//label[contains(@class,"antd4-checkbox-wrapper")])[7]')
    closed = (By.XPATH, '(//label[contains(@class,"antd4-checkbox-wrapper")])[8]')
    # reset = (By.CSS_SELECTOR, '[class="antd4-btn antd4-btn-link antd4-btn-sm"]')
    # ok = (By.CSS_SELECTOR, '[class="antd4-btn antd4-btn-primary antd4-btn-sm"]')
    status_reset =  (By.XPATH, '(//button[contains(@class,"antd4-btn antd4-btn-link antd4-btn-sm")])[2]')
    status_ok = (By.XPATH, '(//button[contains(@class,"antd4-btn antd4-btn-primary antd4-btn-sm")])[2]')
    priority_reset = (By.XPATH, '(//button[contains(@class,"antd4-btn antd4-btn-link antd4-btn-sm")])[1]')
    priority_ok = (By.XPATH, '(//button[contains(@class,"antd4-btn antd4-btn-primary antd4-btn-sm")])[1]')


    reopen_button_in_list = (By.XPATH,'(//button[contains(@class,"table-operation-btnLine-btn")])[1]')

    reopen_button_confirm_in_list = (By.XPATH, '(//button[contains(@class,"antd4-btn-primary")])[3]')

    #搜索的工单的状态
    search_ticket_status = (By.XPATH,'//*[@id="root"]/section/section/main/div/main/div/div/div/div[2]/div/div[2]/div/div/div/div/div/table/tbody/tr[2]/td[8]/span/span[2]')

    #用户名称
    user_name = (By.XPATH,'//*[@id="scrollableDiv"]/div/div/div[2]/div/div[2]/p')

    #详情页返回按钮
    #back_button = (By.XPATH,'//*[@id="root"]/section/section/main/div/main/div/div/div/div/div/div[2]/div/div[1]/span[1]')
    back_button = (By.XPATH,'//*[@class="anticon cre-page-container-header-panel-back cre-page-container-header-panel-back-default"]')


    #详情页的Solving状态
    #solving_status_in_detail = (By.XPATH,'//*[@id="root"]/section/section/main/div/main/div/div/div/div/div/div[3]/div/div[1]/div[2]')
    solving_status_in_detail = (By.XPATH,'//*[text()="Solving"]/..')


    #列表第一条记录的按钮
    last_record_button = (By.XPATH,'(//button[contains(@class,"antd4-btn-link")])[1]/span')


    #列表小红点
    #last_ticket_red_dot = (By.XPATH,'//*[@id="root"]/section/section/main/div/main/div/div/div/div[2]/div/div[2]/div/div/div/div/div/table/tbody/tr[2]/td[1]/span/span[1]')
    last_ticket_red_dot = (By.CSS_SELECTOR,'[style="background: rgb(217, 48, 38);"]')

    #new ticket新消息提醒
    new_tag = (By.XPATH,'//li[contains(@path,"/work_bench/tickets/myTicket")]/span/div/span[2]')

